package com.deam.imsdk.elem;

import com.deam.imsdk.utils.MathUtil;

public abstract class BaseElem {
    public static final int SEND_STATE_NO = -1; //发送失败
    public static final int SEND_STATE_IN = 0; //正在发送
    public static final int SEND_STATE_OK = 1;//成功的

    private ElemType type = ElemType.TEXT;
    //接受人id
    private String acceptorId;
    //发送人id
    private String senderId;
    //linux时间
    private long time;
    //唯一标识
    private String identifying = MathUtil.getSum(null, 32);
    private String context;
    private int sendState = SEND_STATE_IN;

    public enum ElemType {
        TEXT
    }

    public void setType(String name) {
        if (ElemType.TEXT.name().equals(name)) {
            type = ElemType.TEXT;
        }
    }

    public void setType(ElemType type) {
        this.type = type;
    }

    public ElemType getType() {
        return type;
    }

    public String getContext() {
        return context;
    }

    public void setContext(String context) {
        this.context = context;
    }

    public String getAcceptorId() {
        return acceptorId;
    }

    public void setAcceptorId(String acceptorId) {
        this.acceptorId = acceptorId;
    }

    public String getSenderId() {
        return senderId;
    }

    public void setSenderId(String senderId) {
        this.senderId = senderId;
    }

    public abstract String toMessageString();

    public long getTime() {
        return time;
    }

    public void setTime(long time) {
        this.time = time;
    }

    public String getIdentifying() {
        return identifying;
    }

    public void setIdentifying(String identifying) {
        this.identifying = identifying;
    }

    public int getSendState() {
        return sendState;
    }

    public void setSendState(int sendState) {
        this.sendState = sendState;
    }
}
